<?
        $results = array();
        require_once('../inc/ShCar.php');
        if(isset($_POST['purchase_ID']))
        {
                $row = $_POST;
                $results = saveShCart($row);
                if($results === true)
                {
               			header("Location: index.php?inserted=".$row['purchase_ID']."&item_ID=".$row['item_ID']);
                        die();
                }
          
        }else{
        	if(isset($_REQUEST['purchase_ID']))
                $row = getCar($_REQUEST);
            else
            	$row = blankShCart();
        }
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Details of Shopping Cart</title>
    <link rel="stylesheet" type="text/css" href="../inc/bootstrap.css" />
    <style type="text/css">
        .error { color: red; }
    </style>
</head>

<body>
        <div class="container">
            <div id="contents">
               <dl class="error">
                        <? foreach ($results as $key => $value): ?>
                                                <dt><?=$key?></dt>
                                                <dd><?=$value?></dd>
                                        <? endforeach; ?>
                </dl>
               
                <form class="form-horizontal" method="post" action="">
                
                    <div class=" control-group">
                        <label class="control-label" for="purchase_ID">Purchase ID:</label>
                        <div class="controls">
                            <input type="text" name="purchase_ID" id="purchase_ID" value="<?=$row['purchase_ID']?>" style="width:110px"/>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="item_ID">Serial Number:</label>
                        <div class="controls">
                            <input type="text" name="item_ID" id="item_ID" value="<?=$row['item_ID']?>" style="width:110px"/>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="quantity">Quantity:</label>
                        <div class="controls">
                            <input type="text" name="quantity" id="quantity" value="<?=$row['quantity']?>" style="width:110px"/>
                        </div>
                    </div>
                    <div class=" control-group">
                        <div class="controls">
                        </div>
                    </div>

                     <div class=" control-group">
                        <div class="controls">
                        <input class="btn btn-primary" type="submit" value="Save" />
                            <a href="./" class="cancel-link">Cancel</a>
                        </div>
                    </div>
                </form>
           </div>
       </div>
</body>
</html>
